package com.bjqg.bjqg01.bjqg.adapter;

import android.graphics.Color;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.view.View;

import com.bjqg.bjqg01.bjqg.R;
import com.bjqg.bjqg01.bjqg.bean.Client;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

/**
 * Created by bjqg01 on 2017/12/14.
 */

public class ClientManageAdapter extends BaseQuickAdapter<Client,BaseViewHolder>{

    public ClientManageAdapter(@LayoutRes int layoutResId, @Nullable List<Client> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, Client item) {

        helper.setText(R.id.client_item,"委托人："+item.getClient())
                .setText(R.id.client_phone_num_item,"委托人电话："+item.getClientPhoneNum())
                .setText(R.id.client_company_item,"委托人单位："+item.getClientCompany())
                .addOnClickListener(R.id.default_client)
                .addOnClickListener(R.id.client_update);
        if (item.getChoose()){
//            helper.getView(R.id.default_client).setVisibility(View.VISIBLE);
            helper.setChecked(R.id.default_client,true)
                    .setText(R.id.default_client,"默认委托人")
                    .setTextColor(R.id.default_client, Color.RED);
        }else {
//            helper.getView(R.id.default_client).setVisibility(View.GONE);
            helper.setChecked(R.id.default_client,false)
                    .setText(R.id.default_client,"设为默认")
                    .setTextColor(R.id.default_client,Color.BLACK);
        }
    }
}
